package com.AplTest;

import java.util.Scanner;

public class AplTest2 {
    public static void main(String[] args) {
        //自己实现parseInt方法的效果
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String s = sc.nextLine();
        String str = "([\\d&&[^0]])\\d{0,9}";
        boolean flag =  s.matches(str);
        if (!flag){
            System.out.println("输入的字符串有误：");
            return;
        }

        int sum = 0;
        for (int i = 0; i < s.length(); i++){
            int c = s.charAt(i) - '0';
            sum = sum * 10 + c;
        }
        System.out.println(sum);
        System.out.println(sum +  1);
    }
}
